/**
 * 问题管理初始化
 */
var WzQuestion = {
    id: "wzAddQuestionTable",	//表格id
    seItem: null,		//选中的条目
    table: null,
    layerIndex: -1,
    wzQuestionData: {},
    type:""
};

/**
 * 初始化表格的列
 */
WzQuestion.initColumn = function () {
    return [
        {field: 'selectItem', check: true},
        {title: '问题id', field: 'questionId', visible: true, align: 'center', valign: 'middle'},
        {title: '问题', field: 'question', visible: true, align: 'center', valign: 'middle'},
        {title: '状态', field: 'status', visible: true, align: 'center', valign: 'middle'}
    ];
};



$("#type").change(function () {
    var type = $(this).children('option:selected').val();
    WzQuestion.type=type;
    var opt = {
        url: "/wzQuestionnaire/addQuestions",
        silent: true,
        query:{
            type: type
        }
    };
    $("#wzAddQuestionTable").bootstrapTable('refresh', opt);
});

$(function () {
    var type = $("#type").val();
    var defaultColunms = WzQuestion.initColumn();
    if(type == ""){
        var table = new BSTable(WzQuestion.id, "/wzQuestionnaire/addQuestions", defaultColunms,350,5);
    }else{
        var table = new BSTable(WzQuestion.id, "/wzQuestionnaire/addQuestions?type="+type, defaultColunms,350,5);
    }

    table.setPaginationType("client");
    WzQuestion.table = table.init();
});
